Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Runtime.​InteropServices.​WeakGCHandle<​T>

Assembly: System.Runtime

Implemented Interfaces

Represents a strongly typed GC handle to a managed object.

Properties

public bool
IsAllocated
Gets a value that indicates whether this handle has been allocated or not.

Methods

public void
Dispose​()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public bool
Equals​(object obj)
Indicates whether this instance and a specified object are equal.
Returns <code data-dev-comment-type="langword">true</code> if <code data-dev-comment-type="paramref">obj</code> and this instance are the same type and represent the same value; otherwise, <code data-dev-comment-type="langword">false</code> .
obj The object to compare with the current instance.
public bool
Equals​(WeakGCHandle<​T> other)
Indicates whether the current object is equal to another object of the same type.
Returns <code data-dev-comment-type="langword">true</code> if the current object is equal to the <code data-dev-comment-type="paramref">other</code> parameter; otherwise, <code data-dev-comment-type="langword">false</code> .
other An object to compare with this object.
public static WeakGCHandle<​T>
FromIntPtr​(nint value)
Returns a new <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object created from a handle to a managed object.
Returns A new <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object that corresponds to the value parameter.
value An <see cref="T:System.IntPtr" /> handle to a managed object to create a <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object from.
public int
GetHashCode​()
Returns the hash code for the current instance.
Returns A hash code for the current instance.
public void
SetTarget​(T target)
Sets the object this handle represents.
public static nint
ToIntPtr​(WeakGCHandle<​T> value)
Returns the internal integer representation of a <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object.
Returns An <see cref="T:System.IntPtr" /> object that represents a <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object.
value A <see cref="T:System.Runtime.InteropServices.WeakGCHandle`1" /> object to retrieve an internal integer representation from.
public bool
TryGetTarget​(T& target)
public string
ToString​()
Inherited from ValueType
Returns the fully qualified type name of this instance.
Returns The fully qualified type name.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .